package com.htd.erp.model;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;


/**
 * @author Zhang Guilin
 */
@Entity
public class Product extends NamedEntity {

	private static final long serialVersionUID = 1307936344421764157L;
	
	@Column(length = 420)
	@Size(max = 140)
	private String model;
	
	@ManyToMany(fetch = FetchType.EAGER)
	private List<Color> colors = new ArrayList<Color>();
	
	@ManyToOne(fetch = FetchType.EAGER)
	private Specification specification;
	
	@NotNull
	@ManyToOne(fetch = FetchType.EAGER)
	private Classification classification;
	
	@ManyToOne(fetch = FetchType.EAGER)
	private Os os;
	
	@Column(precision = 8, scale = 2)
	@Min(value = 0)
	private double rebates;
	
	@Column(precision = 8, scale = 2)
	@Min(value = 0)
	private double purchasePrice;
	
	@Column(precision = 8, scale = 2)
	@Min(value = 0)
	private double clerkPrice;
	
	private boolean virtualized;
	
	private boolean stopSelling;
	
	@Column(length = 420)
	@Size(max = 140)
	private String comments;
	
	@Min(value = 0)
	private int inventory = 0;

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public List<Color> getColors() {
		return colors;
	}

	public void setColors(List<Color> colors) {
		this.colors = colors;
	}

	public Specification getSpecification() {
		return specification;
	}

	public void setSpecification(Specification specification) {
		this.specification = specification;
	}

	public Os getOs() {
		return os;
	}

	public void setOs(Os os) {
		this.os = os;
	}

	public double getRebates() {
		return rebates;
	}

	public void setRebates(double rebates) {
		this.rebates = rebates;
	}

	public double getPurchasePrice() {
		return purchasePrice;
	}

	public void setPurchasePrice(double purchasePrice) {
		this.purchasePrice = purchasePrice;
	}

	public double getClerkPrice() {
		return clerkPrice;
	}

	public void setClerkPrice(double clerkPrice) {
		this.clerkPrice = clerkPrice;
	}

	public boolean isVirtualized() {
		return virtualized;
	}

	public void setVirtualized(boolean virtualized) {
		this.virtualized = virtualized;
	}

	public boolean isStopSelling() {
		return stopSelling;
	}

	public void setStopSelling(boolean stopSelling) {
		this.stopSelling = stopSelling;
	}

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	public int getInventory() {
		return inventory;
	}

	public void setInventory(int inventory) {
		this.inventory = inventory;
	}

	public Classification getClassification() {
		return classification;
	}

	public void setClassification(Classification classification) {
		this.classification = classification;
	}
}
